﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace UCWebpart
{
    public partial class WebUserControl1 : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack) 
            //{
            //    //Bind();
            //}
        }
        //private void Bind() 
        //{
        //    MTR_bas_Resources res = new MTR_bas_Resources();
        //    data
        //    GridView1.DataSource = dt;
        //}

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            MTR_bas_Resources res = new MTR_bas_Resources();
            
            meetingroomManagementEntities mtrmEntities = new meetingroomManagementEntities();
            var cls = (from c in mtrmEntities.MTR_bas_Resources
                       where c.resId == 3
                       select c).SingleOrDefault<MTR_bas_Resources>();
            //GridView1.
        }
        // 当用户点击其它页的时候，程序运行这里
        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 
        {

        }

        /// 当用户点击删除按钮的时候，程序执行这

        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            
        }
        //当用户点击编辑的时候，程序这里
        protected void GridView1_RowEditing(object sender,GridViewEditEventArgs e)
        {
        
        }
        //当用户输入自己要更新的数据，点击更新按钮，执行这里
        protected void GridView1_RowUpdating(Object sender,GridViewUpdatedEventArgs e) 
        { 
        
        }

        protected void GridView1_RowUpdating1(object sender, GridViewUpdateEventArgs e)
        {

        }

        protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs  e) 
        {
            GridView1.DataSourceID = "EntityDataSource2";
            GridView1.DataBind();
        }

        protected void DetailsView1_PageIndexChanging(object sender, DetailsViewPageEventArgs e)
        {

        }

        protected void GridView1_RowCommand1(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Insert")
            {
                GridView1.DataSourceID = "";
                GridView1.DataBind();
            }
        }

        protected void GridView1_PageIndexChanging1(object sender, GridViewPageEventArgs e)
        {

        }

        protected void EntityDataSource2_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
        {

        }

        protected void EntityDataSource1_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
        {

        }
    }
}